﻿CREATE TABLE [dbo].[Hotel] (
    [HotelId]               INT            IDENTITY (1, 1) NOT NULL,
    [Name]                  NVARCHAR (256) NOT NULL,
    [EarliestCheckIn]       TIME (7)       NULL,
    [LatestCheckOut]        TIME (7)       NULL,
    [AddressId]             INT            NOT NULL,
    [UserId]                INT            NOT NULL,
    [PhoneNumber]           NVARCHAR (MAX) NULL,
    [Email]                 NVARCHAR (64)  NULL,
    [HotelTypeId]           INT            NOT NULL,
    [Description]           NVARCHAR (MAX) NULL,
    [Earnest]               INT            NULL,
    [ReservationDenyPeriod] INT            NULL,
    [ContactPeriod]         INT            NULL,
    [ReservationTypeId]     INT            NULL,
    [Stars]                 TINYINT        NOT NULL,
    CONSTRAINT [PK_Hotel] PRIMARY KEY CLUSTERED ([HotelId] ASC),
    CONSTRAINT [FK_Hotel_Address] FOREIGN KEY ([AddressId]) REFERENCES [dbo].[Address] ([AddressId]),
    CONSTRAINT [FK_Hotel_HotelType] FOREIGN KEY ([HotelTypeId]) REFERENCES [dbo].[HotelType] ([HotelTypeId]),
    CONSTRAINT [FK_Hotel_ReservationType] FOREIGN KEY ([ReservationTypeId]) REFERENCES [dbo].[ReservationType] ([ReservationTypeId]),
    CONSTRAINT [FK_Hotel_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([UserId])
);

